﻿using System;

namespace Iterator
{
    class Program
    {
        static void Main(string[] args)
        {
            ConcreteAggregate a = new ConcreteAggregate();

            a[0] = "1";
            a[1] = "2";
            a[2] = "3";
            a[3] = "4";
            a[4] = "5";
            a[5] = "6";

            Iterator i = new ConcreteIterator(a);
            object item = i.First();
            while (!i.IsDone())
            {
                Console.WriteLine("序号{0}", i.CurrentItem());
                i.Next();
            }

            Console.Read();

        }
    }
}
